<!DOCTYPE html>
<html lang=zh>
<head><meta name="generator" content="Hexo 3.9.0">
    <!-- so meta -->
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="HandheldFriendly" content="True">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="description" content="前言今天记录下自己处理线上服务器内存不足的问题的过程。某天 xxx 跟我说线上服务器现在很卡，接口响应比较慢。我就纳闷了一个 2G 内存的服务器能支持 4000 千的访问量吗？不过还是得去看下，当我敲下free -m看到了如下信息： 如何清除火速去查了下free -m各自代表的意思，答案如下：  为了提高磁盘存取效率，Linux 做了一些精心的设计，除了对 dentry 进行缓存（用于 VFS，加">
<meta name="keywords" content="linux">
<meta property="og:type" content="article">
<meta property="og:title" content="Linux清除内存缓存">
<meta property="og:url" content="https://andyliwr.github.io/2018/10/29/ubuntu_clean_cache/index.html">
<meta property="og:site_name" content="月光倾城的代码小屋">
<meta property="og:description" content="前言今天记录下自己处理线上服务器内存不足的问题的过程。某天 xxx 跟我说线上服务器现在很卡，接口响应比较慢。我就纳闷了一个 2G 内存的服务器能支持 4000 千的访问量吗？不过还是得去看下，当我敲下free -m看到了如下信息： 如何清除火速去查了下free -m各自代表的意思，答案如下：  为了提高磁盘存取效率，Linux 做了一些精心的设计，除了对 dentry 进行缓存（用于 VFS，加">
<meta property="og:locale" content="zh-CN">
<meta property="og:image" content="https://file.lantingshucheng.com/1540800401850.png">
<meta property="og:image" content="https://file.lantingshucheng.com/1540802248956.png">
<meta property="og:updated_time" content="2020-01-15T06:30:09.120Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Linux清除内存缓存">
<meta name="twitter:description" content="前言今天记录下自己处理线上服务器内存不足的问题的过程。某天 xxx 跟我说线上服务器现在很卡，接口响应比较慢。我就纳闷了一个 2G 内存的服务器能支持 4000 千的访问量吗？不过还是得去看下，当我敲下free -m看到了如下信息： 如何清除火速去查了下free -m各自代表的意思，答案如下：  为了提高磁盘存取效率，Linux 做了一些精心的设计，除了对 dentry 进行缓存（用于 VFS，加">
<meta name="twitter:image" content="https://file.lantingshucheng.com/1540800401850.png">
    
    
        
          
              <link rel="shortcut icon" href="/images/favicon.ico">
          
        
        
          
            <link rel="icon" type="image/png" href="/images/favicon-192x192.png" sizes="192x192">
          
        
        
          
            <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon.png">
          
        
    
    <!-- title -->
    <title>Linux清除内存缓存</title>
    <!-- styles -->
    <link rel="stylesheet" href="/css/style.css">
    <!-- persian styles -->
    
      <link rel="stylesheet" href="/css/rtl.css">
    
    <!-- rss -->
    
    
</head>

<body class="max-width mx-auto px3 ltr">
    
      <div id="header-post">
  <a id="menu-icon" href="#"><i class="fas fa-bars fa-lg"></i></a>
  <a id="menu-icon-tablet" href="#"><i class="fas fa-bars fa-lg"></i></a>
  <a id="top-icon-tablet" href="#" onclick="$('html, body').animate({ scrollTop: 0 }, 'fast');" style="display:none;"><i class="fas fa-chevron-up fa-lg"></i></a>
  <span id="menu">
    <span id="nav">
      <ul>
         
          <li><a href="/">首页</a></li>
         
          <li><a href="/archives/">归档</a></li>
         
          <li><a href="/search/">搜索</a></li>
         
          <li><a href="/tags/">标签</a></li>
         
          <li><a href="/others/">其他文章</a></li>
        
      </ul>
    </span>
    <br/>
    <span id="actions">
      <ul>
        
        <li><a class="icon" href="/2018/10/30/brower_open_application/"><i class="fas fa-chevron-left" aria-hidden="true" onmouseover="$('#i-prev').toggle();" onmouseout="$('#i-prev').toggle();"></i></a></li>
        
        
        <li><a class="icon" href="/2018/10/28/mbook_use_sentry/"><i class="fas fa-chevron-right" aria-hidden="true" onmouseover="$('#i-next').toggle();" onmouseout="$('#i-next').toggle();"></i></a></li>
        
        <li><a class="icon" href="#" onclick="$('html, body').animate({ scrollTop: 0 }, 'fast');"><i class="fas fa-chevron-up" aria-hidden="true" onmouseover="$('#i-top').toggle();" onmouseout="$('#i-top').toggle();"></i></a></li>
        <li><a class="icon" href="#"><i class="fas fa-share-alt" aria-hidden="true" onmouseover="$('#i-share').toggle();" onmouseout="$('#i-share').toggle();" onclick="$('#share').toggle();return false;"></i></a></li>
      </ul>
      <span id="i-prev" class="info" style="display:none;">上一篇</span>
      <span id="i-next" class="info" style="display:none;">下一篇</span>
      <span id="i-top" class="info" style="display:none;">返回顶部</span>
      <span id="i-share" class="info" style="display:none;">分享文章</span>
    </span>
    <br/>
    <div id="share" style="display: none">
      <ul>
  <li><a class="icon" href="http://www.facebook.com/sharer.php?u=https://andyliwr.github.io/2018/10/29/ubuntu_clean_cache/"><i class="fab fa-facebook " aria-hidden="true"></i></a></li>
  <li><a class="icon" href="https://twitter.com/share?url=https://andyliwr.github.io/2018/10/29/ubuntu_clean_cache/&text=Linux清除内存缓存"><i class="fab fa-twitter " aria-hidden="true"></i></a></li>
  <li><a class="icon" href="http://www.linkedin.com/shareArticle?url=https://andyliwr.github.io/2018/10/29/ubuntu_clean_cache/&title=Linux清除内存缓存"><i class="fab fa-linkedin " aria-hidden="true"></i></a></li>
  <li><a class="icon" href="https://pinterest.com/pin/create/bookmarklet/?url=https://andyliwr.github.io/2018/10/29/ubuntu_clean_cache/&is_video=false&description=Linux清除内存缓存"><i class="fab fa-pinterest " aria-hidden="true"></i></a></li>
  <li><a class="icon" href="mailto:?subject=Linux清除内存缓存&body=Check out this article: https://andyliwr.github.io/2018/10/29/ubuntu_clean_cache/"><i class="fas fa-envelope " aria-hidden="true"></i></a></li>
  <li><a class="icon" href="https://getpocket.com/save?url=https://andyliwr.github.io/2018/10/29/ubuntu_clean_cache/&title=Linux清除内存缓存"><i class="fab fa-get-pocket " aria-hidden="true"></i></a></li>
  <li><a class="icon" href="http://reddit.com/submit?url=https://andyliwr.github.io/2018/10/29/ubuntu_clean_cache/&title=Linux清除内存缓存"><i class="fab fa-reddit " aria-hidden="true"></i></a></li>
  <li><a class="icon" href="http://www.stumbleupon.com/submit?url=https://andyliwr.github.io/2018/10/29/ubuntu_clean_cache/&title=Linux清除内存缓存"><i class="fab fa-stumbleupon " aria-hidden="true"></i></a></li>
  <li><a class="icon" href="http://digg.com/submit?url=https://andyliwr.github.io/2018/10/29/ubuntu_clean_cache/&title=Linux清除内存缓存"><i class="fab fa-digg " aria-hidden="true"></i></a></li>
  <li><a class="icon" href="http://www.tumblr.com/share/link?url=https://andyliwr.github.io/2018/10/29/ubuntu_clean_cache/&name=Linux清除内存缓存&description="><i class="fab fa-tumblr " aria-hidden="true"></i></a></li>
</ul>

    </div>
    <div id="toc">
      <ol class="toc"><li class="toc-item toc-level-3"><a class="toc-link" href="#前言"><span class="toc-number">1.</span> <span class="toc-text">前言</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#如何清除"><span class="toc-number">2.</span> <span class="toc-text">如何清除</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#那么如何手动释放缓存呢？"><span class="toc-number">2.1.</span> <span class="toc-text">那么如何手动释放缓存呢？</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#为什么free那么小"><span class="toc-number">2.2.</span> <span class="toc-text">为什么free那么小</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#定时脚本"><span class="toc-number">3.</span> <span class="toc-text">定时脚本</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#备注"><span class="toc-number">4.</span> <span class="toc-text">备注</span></a></li></ol>
    </div>
  </span>
</div>

    
    <div class="content index py4">
        
        <article class="post" itemscope itemtype="http://schema.org/BlogPosting">
  <header>
    
    <h1 class="posttitle" itemprop="name headline">
        Linux清除内存缓存
    </h1>



    <div class="meta">
      <span class="author" itemprop="author" itemscope itemtype="http://schema.org/Person">
        <span itemprop="name">月光倾城的代码小屋</span>
      </span>
      
    <div class="postdate">
        <time datetime="2018-10-29T15:32:01.000Z" itemprop="datePublished">2018-10-29</time>
    </div>


      

      
    <div class="article-tag">
        <i class="fas fa-tag"></i>
        <a class="tag-link" href="/tags/linux/">linux</a>
    </div>


    </div>
  </header>
  

  <div class="content" itemprop="articleBody">
    <h3 id="前言"><a href="#前言" class="headerlink" title="前言"></a>前言</h3><p>今天记录下自己处理线上服务器内存不足的问题的过程。<br>某天 xxx 跟我说线上服务器现在很卡，接口响应比较慢。我就纳闷了一个 2G 内存的服务器能支持 4000 千的访问量吗？不过还是得去看下，当我敲下<code>free -m</code>看到了如下信息：<br><img src="https://file.lantingshucheng.com/1540800401850.png" alt="内存使用情况"></p>
<h3 id="如何清除"><a href="#如何清除" class="headerlink" title="如何清除"></a>如何清除</h3><p>火速去查了下<code>free -m</code>各自代表的意思，答案如下：<br><img src="https://file.lantingshucheng.com/1540802248956.png" alt="字段说明"></p>
<blockquote>
<p>为了提高磁盘存取效率，Linux 做了一些精心的设计，除了对 dentry 进行缓存（用于 VFS，加速文件路径名到 inode 的转换），还采取了两种主要 Cache 方式：Buffer Cache 和 Page Cache。前者针对磁盘块的读写，后者针对文件 inode 的读写。这些 Cache 有效缩短了 I/O 系统调用（比如 read，write，getdents）的时间。<br>摘抄至 <a href="http://www.linuxde.net/2011/07/402.html" target="_blank" rel="noopener">http://www.linuxde.net/2011/07/402.html</a></p>
</blockquote>
<h4 id="那么如何手动释放缓存呢？"><a href="#那么如何手动释放缓存呢？" class="headerlink" title="那么如何手动释放缓存呢？"></a>那么如何手动释放缓存呢？</h4><p><code>/proc</code>是一个虚拟文件系统，我们可以通过对它的读写操作做为与<code>kernel</code>实体间进行通信的一种手段。也就是说可以通过修改<code>/proc</code>中的文件，来对当前<code>kernel</code>的行为做出调整。那么我们可以通过调整<code>/proc/sys/vm/drop_caches</code>来释放内存。操作如下：</p>
<ol>
<li>查看/proc/sys/vm/drop_caches 的值</li>
</ol>
<figure class="highlight awk"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">cat <span class="regexp">/proc/</span>sys<span class="regexp">/vm/</span>drop_caches</span><br></pre></td></tr></table></figure>
<ol start="2">
<li>手动执行 <code>sync</code> 命令（描述：<code>sync</code> 命令运行 <code>sync</code> 子例程。如果必须停止系统，则运行 <code>sync</code> 命令以确保文件系统的完整性。<code>sync</code> 命令将所有未写的系统缓冲区写到磁盘中，包含已修改的 <code>i-node</code>、已延迟的块 <code>I/O</code> 和读写映射文件）</li>
</ol>
<figure class="highlight vim"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">sync</span> &amp;&amp; <span class="keyword">echo</span> <span class="number">3</span> &gt; /proc/sys/<span class="keyword">vm</span>/drop_caches</span><br></pre></td></tr></table></figure>
<p>此时在输入<code>free -m</code>就会发现 <code>buffer</code> 和 <code>cache</code> 均被释放了</p>
<h4 id="为什么free那么小"><a href="#为什么free那么小" class="headerlink" title="为什么free那么小"></a>为什么free那么小</h4><p>因为<code>Linux</code>对内存的管理与<code>Windows</code>不同，<code>free</code>小并不是说内存不够用了，应该看的是<code>free</code>的第二行最后一个值：<code>-/+ buffers/cache: 58 191</code>，这才是系统可用的内存大小。</p>
<p>既然核心是可以快速清空buffer或cache，也不难做到（这从上面的操作中可以明显看到），但核心并没有这样做（默认值是0），我们就不应该随便去改变它。一般情况下，应用在系统上稳定运行了，free值也会保持在一个稳定值的，虽然看上去可能比较小。</p>
<p>当发生内存不足、应用获取不到可用内存、OOM错误等问题时，还是更应该去分析应用方面的原因，如用户量太大导致内存不足、发生应用内存溢出等情况，否则，清空buffer，强制腾出free的大小，可能只是把问题给暂时屏蔽了。</p>
<blockquote>
<p>我觉得，排除内存不足的情况外，除非是在软件开发阶段，需要临时清掉buffer，以判断应用的内存使用情况；或应用已经不再提供支持，即使应用对内存的时候确实有问题，而且无法避免的情况下，才考虑定时清空buffer。（可惜，这样的应用通常都是运行在老的操作系统版本上，上面的操作也解决不了）。而生产环境下的服务器可以不考虑手工释放内存，这样会带来更多的问题。记住内存是拿来用的，不是拿来看的。不像windows。</p>
</blockquote>
<blockquote>
<p>无论你的真实物理内存有多少，他都要拿硬盘交换文件来读。这也就是windows为什么常常提示虚拟空间不足的原因，你们想想多无聊，在内存还有大部分的时候，拿出一部分硬盘空间来充当内存。硬盘怎么会快过内存，所以我们看linux，只要不用swap的交换空间，就不用担心自己的内存太少。如果常常swap用很多,可能你就要考虑加物理内存了，这也是linux看内存是否够用的标准哦。</p>
</blockquote>
<h3 id="定时脚本"><a href="#定时脚本" class="headerlink" title="定时脚本"></a>定时脚本</h3><ol>
<li><p>新建一个bash文件，写入如下代码</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">#!/bin/bash</span></span><br><span class="line"></span><br><span class="line">used=`free -m | awk <span class="string">'NR==2'</span> | awk <span class="string">'&#123;print $3&#125;'</span>`</span><br><span class="line">free=`free -m | awk <span class="string">'NR==2'</span> | awk <span class="string">'&#123;print $4&#125;'</span>`</span><br><span class="line"></span><br><span class="line"><span class="built_in">echo</span> <span class="string">"==========================="</span> &gt;&gt; /var/<span class="built_in">log</span>/mem.log</span><br><span class="line">date &gt;&gt; /var/<span class="built_in">log</span>/mem.log</span><br><span class="line"><span class="built_in">echo</span> <span class="string">"Memory usage | [Use：<span class="variable">$&#123;used&#125;</span>MB][Free：<span class="variable">$&#123;free&#125;</span>MB]"</span> &gt;&gt; /var/<span class="built_in">log</span>/mem.log</span><br><span class="line"></span><br><span class="line"><span class="keyword">if</span> [ <span class="variable">$free</span> -le 100 ] ; <span class="keyword">then</span></span><br><span class="line">  sync &amp;&amp; <span class="built_in">echo</span> 1 &gt; /proc/sys/vm/drop_caches</span><br><span class="line">  sync &amp;&amp; <span class="built_in">echo</span> 2 &gt; /proc/sys/vm/drop_caches</span><br><span class="line">  sync &amp;&amp; <span class="built_in">echo</span> 3 &gt; /proc/sys/vm/drop_caches</span><br><span class="line">  <span class="built_in">echo</span> <span class="string">"OK"</span> &gt;&gt; /var/<span class="built_in">log</span>/mem.log</span><br><span class="line"><span class="keyword">else</span></span><br><span class="line">  <span class="built_in">echo</span> <span class="string">"Not required"</span> &gt;&gt; /var/<span class="built_in">log</span>/mem.log</span><br></pre></td></tr></table></figure>
</li>
<li><p>添加可执行权限</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">chmod +x xxx.sh</span><br></pre></td></tr></table></figure>
</li>
<li><p>将脚本加入到定时任务中</p>
<pre><code class="bash">sudo vi /etc/crontab
<span class="comment"># 写入</span>
*/30 * * * * root /root/satools/freemem.sh
</code></pre>
</li>
</ol>
<h3 id="备注"><a href="#备注" class="headerlink" title="备注"></a>备注</h3><p>文章大部分摘抄于LinuxToday，<a href="http://www.linuxde.net/2011/07/402.html" target="_blank" rel="noopener">点击此处查看原文</a></p>

  </div>
  <div class="statement">
    <hr>  
    1. 如果本文帮到了您，不妨点一下右上角的”<i class="fas fa-share-alt"></i>“按钮。<br>
    2. 除非注明，本博文章均为原创，转载请以链接形式标明本文地址。<br>
    3. 如果你有任何疑问，欢迎发送邮件到我的邮箱<a href="mailto:andyliwr@outlook.com">andyliwr@outlook.com<br>
  </div>
</article>


    <div class="blog-post-comments">
        <div id="gitalk_thread">
            <noscript>加载评论需要在浏览器启用 JavaScript 脚本支持。</noscript>
        </div>
    </div>



        
          <div id="footer-post-container">
  <div id="footer-post">

    <div id="nav-footer" style="display: none">
      <ul>
         
          <li><a href="/">首页</a></li>
         
          <li><a href="/archives/">归档</a></li>
         
          <li><a href="/search/">搜索</a></li>
         
          <li><a href="/tags/">标签</a></li>
         
          <li><a href="/others/">其他文章</a></li>
        
      </ul>
    </div>

    <div id="toc-footer" style="display: none">
      <ol class="toc"><li class="toc-item toc-level-3"><a class="toc-link" href="#前言"><span class="toc-number">1.</span> <span class="toc-text">前言</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#如何清除"><span class="toc-number">2.</span> <span class="toc-text">如何清除</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#那么如何手动释放缓存呢？"><span class="toc-number">2.1.</span> <span class="toc-text">那么如何手动释放缓存呢？</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#为什么free那么小"><span class="toc-number">2.2.</span> <span class="toc-text">为什么free那么小</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#定时脚本"><span class="toc-number">3.</span> <span class="toc-text">定时脚本</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#备注"><span class="toc-number">4.</span> <span class="toc-text">备注</span></a></li></ol>
    </div>

    <div id="share-footer" style="display: none">
      <ul>
  <li><a class="icon" href="http://www.facebook.com/sharer.php?u=https://andyliwr.github.io/2018/10/29/ubuntu_clean_cache/"><i class="fab fa-facebook fa-lg" aria-hidden="true"></i></a></li>
  <li><a class="icon" href="https://twitter.com/share?url=https://andyliwr.github.io/2018/10/29/ubuntu_clean_cache/&text=Linux清除内存缓存"><i class="fab fa-twitter fa-lg" aria-hidden="true"></i></a></li>
  <li><a class="icon" href="http://www.linkedin.com/shareArticle?url=https://andyliwr.github.io/2018/10/29/ubuntu_clean_cache/&title=Linux清除内存缓存"><i class="fab fa-linkedin fa-lg" aria-hidden="true"></i></a></li>
  <li><a class="icon" href="https://pinterest.com/pin/create/bookmarklet/?url=https://andyliwr.github.io/2018/10/29/ubuntu_clean_cache/&is_video=false&description=Linux清除内存缓存"><i class="fab fa-pinterest fa-lg" aria-hidden="true"></i></a></li>
  <li><a class="icon" href="mailto:?subject=Linux清除内存缓存&body=Check out this article: https://andyliwr.github.io/2018/10/29/ubuntu_clean_cache/"><i class="fas fa-envelope fa-lg" aria-hidden="true"></i></a></li>
  <li><a class="icon" href="https://getpocket.com/save?url=https://andyliwr.github.io/2018/10/29/ubuntu_clean_cache/&title=Linux清除内存缓存"><i class="fab fa-get-pocket fa-lg" aria-hidden="true"></i></a></li>
  <li><a class="icon" href="http://reddit.com/submit?url=https://andyliwr.github.io/2018/10/29/ubuntu_clean_cache/&title=Linux清除内存缓存"><i class="fab fa-reddit fa-lg" aria-hidden="true"></i></a></li>
  <li><a class="icon" href="http://www.stumbleupon.com/submit?url=https://andyliwr.github.io/2018/10/29/ubuntu_clean_cache/&title=Linux清除内存缓存"><i class="fab fa-stumbleupon fa-lg" aria-hidden="true"></i></a></li>
  <li><a class="icon" href="http://digg.com/submit?url=https://andyliwr.github.io/2018/10/29/ubuntu_clean_cache/&title=Linux清除内存缓存"><i class="fab fa-digg fa-lg" aria-hidden="true"></i></a></li>
  <li><a class="icon" href="http://www.tumblr.com/share/link?url=https://andyliwr.github.io/2018/10/29/ubuntu_clean_cache/&name=Linux清除内存缓存&description="><i class="fab fa-tumblr fa-lg" aria-hidden="true"></i></a></li>
</ul>

    </div>

    <div id="actions-footer">
        <a id="menu" class="icon" href="#" onclick="$('#nav-footer').toggle();return false;"><i class="fas fa-bars fa-lg" aria-hidden="true"></i> 菜单</a>
        <a id="toc" class="icon" href="#" onclick="$('#toc-footer').toggle();return false;"><i class="fas fa-list fa-lg" aria-hidden="true"></i> 目录</a>
        <a id="share" class="icon" href="#" onclick="$('#share-footer').toggle();return false;"><i class="fas fa-share-alt fa-lg" aria-hidden="true"></i> 分享</a>
        <a id="top" style="display:none" class="icon" href="#" onclick="$('html, body').animate({ scrollTop: 0 }, 'fast');"><i class="fas fa-chevron-up fa-lg" aria-hidden="true"></i> 返回顶部</a>
    </div>

  </div>
</div>

        
        <footer id="footer">
  <div class="footer-left">
    Copyright &copy; 2020 Dikang Li
  </div>
  <div class="footer-right">
    <nav>
      <ul>
         
          <li><a href="/">首页</a></li>
         
          <li><a href="/archives/">归档</a></li>
         
          <li><a href="/search/">搜索</a></li>
         
          <li><a href="/tags/">标签</a></li>
         
          <li><a href="/others/">其他文章</a></li>
        
      </ul>
    </nav>
  </div>
</footer>

    </div>
</body>
</html>
<!-- styles -->
<link rel="stylesheet" href="/lib/font-awesome/css/all.min.css">
<link rel="stylesheet" href="/lib/justified-gallery/css/justifiedGallery.min.css">
<link rel="stylesheet" href="/lib/fancybox/jquery.fancybox.css">

<link rel="stylesheet" href="https://file.lantingshucheng.com/blog/v3/static/styles/gitalk.css">


<!-- jquery -->
<script src="/lib/jquery/jquery.min.js"></script>
<script src="/lib/justified-gallery/js/jquery.justifiedGallery.min.js"></script>
<script src="/lib/fancybox/jquery.fancybox.pack.js"></script>

<script type="text/javascript" src="https://file.lantingshucheng.com/blog/v3/static/scripts/md5.js"></script>
<script type="text/javascript" src="https://file.lantingshucheng.com/blog/v3/static/scripts/gitalk.min.js"></script>

<script src="/js/main.js"></script>
<!-- search -->

<!-- Google Analytics -->

<!-- Baidu Analytics -->

    <script type="text/javascript">
        var _hmt = _hmt || [];
        (function() {
            var hm = document.createElement("script");
            hm.src = "https://hm.baidu.com/hm.js?7851ca7a86be957be994acb77639a5be";
            var s = document.getElementsByTagName("script")[0];
            s.parentNode.insertBefore(hm, s);
        })();
    </script>

<!-- Disqus Comments -->


  <script type="text/javascript">
    window.onload = function(){
      if (window.location.href.indexOf('andyliwr.github.io') > -1) {
        var gitalk = new Gitalk({
          clientID: 'ad6f70df0c70d2b715f9',
          clientSecret: '40384bee244c1e17dd7c37733d21e9ef669e969c',
          repo: 'Andyliwr.github.io',
          owner: 'Andyliwr',
          admin: ['Andyliwr'],
          id: md5(location.pathname),
          distractionFreeMode: 'true'
        })
        gitalk.render('gitalk_thread')
      }
    }
  </script>


